<template>
  <div class="table_caozuo">
    <template v-for="(item, index) in btn">
      <a-button :key="index" @click="handler(index)" v-if="item.isShow" type="primary" style="margin: 0 10px 20px 0">{{
        item.title
      }}</a-button>
    </template>
    <a-table
      rowKey="goodsId"
      :columns="tableOption"
      :dataSource="loadData"
      :pagination="false"
      :loading="loading"
      :scroll="{ x: 1720 }"
    >
      <template slot-scope="text, record, index" slot="indexLabel">
        <span>{{ index + (page.current - 1) * page.size + 1 }}</span>
      </template>
      <span slot="span" slot-scope="text, record">{{
        record.goodsName != '无码商品'
          ? record.pcategoryName
            ? record.pcategoryName + (record.categoryName ? '>' + record.categoryName : '')
            : '无类目'
          : '无码类目'
      }}</span>
      <span slot="action" slot-scope="text, record">
        <template>
          <a-button type="link" @click="kucunLs(record)">库存流水</a-button>
        </template>
      </span>
    </a-table>
    <template>
      <div style="width: 100%; position: relative; height: 100px">
        <a-pagination
          show-quick-jumper
          show-size-changer
          v-model="page.current"
          :page-size-options="['10', '20', '30', '40', '50']"
          :total="page.total"
          :page-size.sync="page.size"
          @showSizeChange="onShowSizeChange"
          @change="onShowSizeChange"
          :show-total="(total) => `共 ${total} 条`"
          style="margin: 2% 0; position: absolute; right: 1%"
        />
      </div>
    </template>
    <a-modal title="库存流水" v-model="dialogVisible" width="50%">
      <a-table
        rowKey="id"
        :columns="tableOption1"
        :dataSource="loadData1"
        :pagination="false"
        :loading="loading1"
      ></a-table>
    </a-modal>
  </div>
</template>

<script src='./list_table.js'></script>

<style lang="less">
.table_caozuo {
  margin: 10px 0px;
}
</style>